#pragma once


#define ENGINE_PROGRESS_DECLARE() int64 iPrgMax; register int64 iPrgStep; int64 iPrgIncr = 0; register int64 iPrgLastRep = 0; 
#define ENGINE_PROGRESS_INIT(STEP, MAX)  { \
	iPrgMax = MAX;  \
	iPrgStep = MAX * STEP / 100;  \
	iPrgIncr = 0; \
	iPrgLastRep = 0; \
}


#define ENGINE_PROGRESS_REPORT(incr, ed) { \
	if(incr >= iPrgLastRep + iPrgStep) {\
		iPrgLastRep = incr; \
		int64 percent = incr * 100 / iPrgMax; \
		if(ed->EnginePercentProgress != NULL) \
			ed->EnginePercentProgress((int)percent, ed);  \
	} \
}
